package breakcontinue;

import java.util.Scanner;

public class BreakDemo2 {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		while (true) {
			System.out.println("请输入一个数字:");
			int num = scan.nextInt();
			
			if (num == 10) {
				// break在循环体中一般搭配if条件语句
				break;  // 退出当前循环体(一定要用在循环体中或者switch中)
			}
		}
		
		System.out.println("游戏结束");
	}
}
